package com.unionx.unionxuf.controller;



import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping(value="/ls")
public class LoaclLsController {
	
	HttpSession session=null;
	@RequestMapping(value="/get/ls")
	public Object getLs(HttpServletRequest request){
	
		 session = request.getSession();
			
			
		
			String nowTime="";
			Date dt=new Date();
			DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
			nowTime= df.format(dt);

			
			String str[] = nowTime.split(" ");
		
			
			String str1[] = str[0].split("/");
			String year = str1[0];
			String month =str1[1];
			String day = str1[2];
			
			String str2[] =str[1].split(":");
			String hour = str2[0];
			String min = str2[1];
			String sec = str2[2];
			
			 long t1=System.currentTimeMillis(); 
			 String  tt1 = t1+"";
			 String dtd = tt1.substring(tt1.length()-2, tt1.length());
	
			
			String code = year+month+day+hour+min+sec+dtd;
			String lscode = code;
	
		
			session.setAttribute("lscode", lscode);
			
			return "/account";
	}
	
	@RequestMapping(value="/fangqi")
	@ResponseBody
	public Object getFangqi(HttpServletRequest request) {
/*		session =request.getSession();
		int  i  = (Integer) session.getAttribute("num");
		i-=1;
		session.setAttribute("num", i);*/
		Map<String,Object> map =  new HashMap<String,Object>();
		map.put("status", 1);
		return map;
		
	}
}
